cmake_minimum_required(VERSION 3.16)                  #c++最小版本

project(loose_couple_all_wg_v2.0)                     #工程名称

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")

set(CMAKE_BUILD_TYPE Debug)

set(CMAKE_CXX_STANDARD 11)                            #c++版本

#set(CMAKE_C_FLAGS_Release "${CMAKE_C_FLAGS_Release} -O3")

#指定输出
#add_executable不会直接生成可执行文件
file(GLOB_RECURSE SOURCE
        lc.cpp
        src/inertial_navigation.cpp
        src/file.cpp
        src/GINS.cpp
        src/class.cpp)
add_executable(${PROJECT_NAME} ${SOURCE} src/initial.cpp)
#用这种也行
#include_directories(${CMAKE_SOURCE_DIR})
#add_executable(imu_algorithm_v2_0 main.cpp GINS.cpp inertial_navigation.cpp file.cpp GINS.cpp class.cpp)

#生成可执行文件
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) #设置可执行文件输出路径，${PROJECT_SOURCE_DIR}为工程顶层目录，必须要在 add_executable 后面
# ${PROJECT_NAME}是工程名称，也就是project()中的内容
# {PROJECT_SOURCE_DIR}是工程绝对路径

# include_directories 只能是头文件的上一个文件夹，不能是头文件
# 而源文件就不一样了，必须是指定文件
# target_link 必须要指定链接到哪一个工程上面！！
# target_link 必须要放在 add_executable 的后面
# locate Python.h
find_package (Python COMPONENTS Interpreter Development)
include_directories(
        ${Python_INCLUDE_DIRS}
)
target_link_libraries(${PROJECT_NAME} ${Python_LIBRARIES})

find_package(yaml-cpp)
if (yaml-cpp_FOUND)
    include_directories(${YAML_CPP_INCLUDE_DIRS})
    target_link_libraries(${PROJECT_NAME} ${YAML_CPP_LIBRARIES})
else(yaml-cpp_FOUND)
    message(FATAL_ERROR "Not found yaml-cpp")
endif(yaml-cpp_FOUND)

# 添加头文件搜索路径
include_directories(${PROJECT_SOURCE_DIR}/3rdparty/eigen)
include_directories(${PROJECT_SOURCE_DIR}/3rdparty/lib_thl)
include_directories(${PROJECT_SOURCE_DIR}/include)
##添加头文件搜索路径
#include_directories("/home/wangguan/Documents/CLionProjects/lib_thl")
#include_directories("/home/wangguan/Documents/CLionProjects")
##两种找到Eigen的方式，但是好像我安装的第二种Eigen有些东西不能用
#include_directories("/home/wangguan/Documents/CLionProjects/eigen-3.4.0")
##find_package(Eigen3 REQUIRED)
##include_directories(${EIGEN3_INCLUDE_DIR})



